Code cleaning

Just some maintenance, and adding some comments