refactoring & add panic interceptor