cleaning up push function, it had some redundant code