Refactored testing code into testing folder