Refactored how .sources files are built