Adds the auto layout supprot

Please review it and merge it.