Refactor tessel.js