refactor js/jquery code into external waylon.js