implemented for both sides. added dynamic return