Refactored the loop class.

We have managed to refactor the loop class, including removing some
peices in order to create an abstraction.

[Branch: development]
Added the new Query Based class.

This class extends the loop and is a loop specific helper.

[Branch: development]