Ugh - WD40 is a water displacer, nothing more. It leaves a gummy residue on whatever its applied too.
If you need to free rusty bolts - use PBBlaster. Automotive brake cleaner would clean without residue, but isn't the nicest stuff to work with. Simple Green works really well for cleaning bikes. Another tip I got from a local wrench is to use Scrubbing Bubbles (the Bathroom cleaner), seems to do a good job on cassettes/freewheels when they are removed. Get a dedicated chain lube/cleaner for your chains. I also use Rock and Roll Gold, its made locally so I support it.