Refactored code to remove Nestable class.