Refactored parse_sources based on code review

Pulled parse_sources into its own file
Added more descriptive variable names
Added unit tests