Fixed various issues with procedures/functions and intervals. Might be
able to call procedures with intervals as parameters/returns