Implement config module and new version of main function