initial code refactoring to prepare for adding dynamic interface support