Added rubocop gem and fixed style, no functional changes

removed trailing whitespace and fixed other whitespace issues
convert 1.8 hash syntax
change double to single quotes where possible
style changes such as preferring map over collect