implemented return type detection