Exit problem solved

Exit problem solved but not the best way, will refactor this some day