refactored tray skeleton code