Beautified and removed unnecessary code.