Implemented TrevorPilley's code review remarks