Made code readable

Also added a check to see if the hint was already closed before closing
it (as it would reopen otherwise)