Reading arguments and cleanup