add _getindex
and remove some ternary operators
#144
Merged
_getindex
and remove some ternary operators
#144