Some more refactoring and cleanup
Update todo