Moved Source type changes to own function