Started to refactor the code & added an array