formatted the code to be presentable in code review