Updated to work with split panels