category logic
minor modifacation