Added hit2hit function, fixed minor bugs