Bug fixed- It aint pretty, but it works.