initial commit of control functions, all marked TODO
remove duplicate function