fixed wrong if statement
added functions
threads start first, then inputs