Took care of a couple of issues

Merge with caution, test has not been extensively tested.