algorithm fixes, google closure compiler ready, RC