Refactor and first true version