logical changes and cut down on excess calls. Needs review.