Refactored some of the changes regarding nested sequence objects and fixed a corner case.