working on cleaning up the code