moved function and readded protected