add return to function. todo: move for control to main function