pull out panel utility functions as a separate file, for less duplication