Improve storage API, clean up code a little up
Refactor code