Quandoo interview question

refactor a code and add functionality