working - but buggy - scala adapter