Turn script to module and use generator for finding course