Refactor to Rubyesque style