This version works. Passed the debug stage.