Remove code duplication and fix a bug with last element in swipe List