Refactoring and adding "crash" method to debug