Refactored code layout, added function stubs