Viagogo Interview Question

refactor a poorly written code segment