more progress on new layout algorithm