Fixig it so taht it compiles
Partially working
Semi wokring version from the hang test