Code cleanup based on reddit comments