Refactoring

Added check function for testing contract failures, used to shorten some
tests