cleaning up output, fixed search, fixed remove head