Changed order around so function calls last