moved functionality to function __getitem__