rewrite for simpler library without DSL