final version of code submitted