tidy up requires and use config object