added scopes for categories
refactoring and error-msg changes