Final version of code
Working copy