Added hits counter, cleaned up some code.