debugged and refined. Working Now.