added scala wrapper impl