Added new dimming code, some shifts are left in that should be gotten rid of to get stuff in the right order of magnitude