Updated Ryan's code