refactor languages model