Reference counting and optimized JS