initial commit: working version, more refactoring to come