Update atp.js

Refactoring