defined functions to have less code in assemble_system()