refactor configure script for improved extensibility