Cleaning up logic per Brandon's advice