Added an exit statement, otherwise Triangle hangs