small stuff with return codes and some cleaning