Refactoring into API/store modules