Fixing Parts of the code