Various cleanup and validations