modifications to adapt it to sharing functionality