Removed the creation of unnecessary User object and cleaned up the code