more functions to agent
Fixed getRank function