Added comments and removed some frivolous code