refactored flexy boxes