refactored sources, added validation