working, but needs refinement