refactored the form-cache, added tests