I hate this code. Mostly working, debugging now