Refactor and draft implementation