added callback listeners and removed old code