refactor: separate imperative and declarative implems