borrows tips from Dancer2