Added further documentation and TODOs while reviewing the code.