started generalizing for the shared mem sample