clean up the input