Refactoring

but broken