added onEnd() function in hAce