refactored testing and made modules slightly more modular