updated to complex numbers