refactored the chunk queue into a seperate class

Would anyone like to test this change for timing assumtions and what the API is like to work with?