Cache implemented, fixes #46