there.... probably a few things to clean up.

wasn't too sure what you were asking from one or two of your comments.
But it works