Cleaner code and some comments