refactor
implement REST API