add extgcd, layout