optional selector and error handling added