added logging, validate function