Added TODOs: cannot not understand the logic of the method at all