Changed the special function code so it's not so ugly.