separate storage functionality from main