Refactors Quiz functionality with JS