adding grouping option, and fixing permissions