some of refactorings, added local file storage functionality, TEST BUILD!