Refactored prompt.js