Refactoring to use internal queue