Improvements based on the AS3 version and params

based on HTML5 StemScopes AS3 port.
Some changes from Deary Hudson