Removing code that is not needed and throws error on complex values