adding building and sorting an array script