Fixed exits and improved other things

Signed-off-by: interdpth <interdpth@gmail.com>