Input verification, misc fixes