refactored trackerapi code

Signed-off-by: Bebe Peng <bebepeng@gmail.com>