Added todo and minor refactoring.