finished removing redundant code