not compiling, but much better structured