cleaned up input/output a bit