Working implementation. Report modules need to be refactored to optimise things.