added exit() to prevent code from executing after location header is set