Newer Ruby allocation method, code refactoring