enhance hint logic and add hint test