refactor programming languages solution a little bit