Cleaning up more logic and adding some comments for any confusion