Added result cacheing and cache clearing and it seems to work okay.
Piecing together some bits and pieces to make sure everything still holds together.