cleaned up code abit based on feedback from PR