eliminate repeated code in Model.java of toC