Move Source functions to Source model file.
Fix code review issues.