pidora.js rewrite. Closes #20