simplifying a complex method, allowing a bit more complexity in rubocop