working on cleaing up the code