refactor question1 and start playing with algorithms