Code cleanup based primarily on hlint recommendations