Fix sanitizing and some cleanup