Reorganize code structure and create some base casses