Adding in a preferences system and doing some light cleanup