Cache implemented, closes #1