cleanup, implemented proper exit codes