restructuring to make the shake and tap work