Added todo and fixed some minor bugs.