Removed unneccessary code
Added some fixes.