Implement panic functionality

Task #2261