initial code commit

beware: this codebase really needs some cleaning/refactoring