refactored freshbooks.js