separate out function definitions from trial code