added TODOs and some refatoring