fixed bugs, added TODOs