working before layouts