Add a 'between' function instead of using 'elem'