finished first draft of compile_model