Refactor advice.js