added some bugs and todos