Improved validation for group names and app ids.

Fixes #1.