Cleaning up things and adding some comments