finished debugging moved function around adding comments