added TODOs; fixed some bugs