working version....still needs refinements