code cleaned up to use dsl