Cleanup/refactor for #3