refactored subscripting and fixed #52