remove exposed functions that were exposed during debugging
general refactoring and improved command handling