WIP: try to refactor to defrecord