Pyjama optimization and expansion