optimize API from fixed code to configuration