Nitpicking the code

Minor changes here and there to remove warnings and make code cleaner and more uniform.
> let callers handle the failure themselves

There are multiple failure points here and returning one `null` doesn't tell the caller which happened. But I can settle with `null` meaning "I can't do it, try somewhere else!".