refactored functions, added testData