Refactored testing. Not sure if it works