Guard panic
Add tests