Added comments and deleted useless functions