removing more unused functions, and moving other functions out of generator