Refactor gesture handler to make container element available for other things