refactored a little and added tests for store