WIP refactors leap.js