Cleaning the code and adding comments, a bit more left