Atma.js: update and refactor (closes GH-816)