Removed unnecessary code, added minor fixes