fixed bug and added tophit feature