Sanitizing

Didn't have a lot of time, just added some quick sanitization to a few
functions.