removed a lot of commented code, made num optional