Test cases revealed some possible problems with type, made changes to mitigate them. Will include test cases soon.