add suggested changes
small refactors to improve understandability