code working basically, cleaned up and now fixing and going to merge in stack overflow answer