fixed pattern match error when sending data of type Shared and cleaned up output