Rubocop and code improvements