Code cleanup for readability and Ruby 1.9 hash syntax