Validations and cleanup