Integrated result cache into rest of code

Signed-off-by: Chris Bunney <crbunney@gmail.com>