Added Ryan's code