working on final version of code