updated for new JS scoping