change script to functions
add argument q_c