improved code quality added count for snippet