litle bit of rearranging and cleanup