Refactor allocation into objects