Implemented more generic inlist