Refactoring answer script to be call from answer.js