modifed so it would be easier to code in the future