Cleanup and hotfix for hit function