Improve code quality and add some todos