Reviewed code, made some refactoring, added/removed some TODOs