Refactor, alert box works