Removed some unused code and completed TODOs.