Implementation of passthrough filter in switch case and refactored the code