Make tests pass and add additional test, fix Rubocop errors