Refactor and fix Rubocop offences (closes #17)