Small bug fix, optimization to factors example