Added count function