Fixed bug with not deleting todos comments

Also some general refactoring while at it.