Made iq functions take consistent parameters
Moved iq error handling to one place