replaced function approach

did if statements instead.