Revised code
Applied minor refactorings
Added TODOs and FIXMEs