Clean up code with rubocop and add code coverage