added more useful test data and refactored the code a little