Added comments and removed useless pieces of code