Cleanup

Basic cleanup and removing some redundant logic.