Make the code more idiomatic

Minor improvements in order to be consistent with Go api.