cleaner code, more comments