Added command pool, executing command count limit and refactoring