final code :)