Remove unnecessary step when sharing, improve readability, add test case

Signed-off-by: Nico Rutishauser <nr@hotmail.ch>