Consolidated a little code