working version, limited initial tetsing done