add share functionality
remove duplicate constraint
refactor flipping code