modify layout algorithm