improved controller's data validation