moving logic to a sepearate file