Minor refactoring, added TODOs and references to open issues.

Updated and cleaned up version of PR #1094.