finnished code