Fixing issue #293 and fixing some todos from before.