added idiomatic generics; small fixes