fixd unneccesary lookup + cleaned up code