factor works with positive numbers. fixing negative ones now