Refactor and device optimizing quiz