added categories
fixed categories logic