Added caching of result.

Signed-off-by: Jan Pecha <janpecha@email.cz>