Moved log statements into functions; Renamed methods