Sharing refactor

Refactored Sharing, things seem to be working. Test also works.