Fixed function and added exit function