code cleanup, conversion to __getitem__