check ya tank breather, it may be nearly or totally blocked...
when you pulled the carb apart did you disassemble it completely and blow out with compressed air?
also did ya check the float height?
and what setting is the slide needle set on...
maybe go a little more on the mixture screw too...
also check the plastic carb spacer between the carb and the manifold, they crack and sometimes the oring goes to sht..
other things to try is another plug,cdi,coil.. iv seen cdi's let an engine idle fine but try and rev it and it will stall or splutter like hell.
as for the rattle, check ya valve clearances while slowly pushing down the kick start(remove spark plug so its easier)
iv seen engines where you set the valve clearances then do a couple of rotations on the engine then the clearances are either massive or none. not sure what causes it but reset them where the clearances seem the largest... then recheck in the normal location
also just check ya cam timing, 1 tooth out can let it run but also let the valves come close or even touch the piston...would also give a rattle obviously and will make the valve clearance act up too...
but im gonna bet its probly the cdi...is it running an inner rotor?