Refactored to support both hierarchical and flat lists. Added support for mouse and keyboard navigation.