refactor/simplify constant generation