implementation & refactor