integrate main and storage

uncompleted.