Removed unnecessary code and reformatted.