got something working, more cleanup may be necesary