A litle restructuring and clean up