Handle optionals a bit better

By using `fmap` and `apply`, we can handle the case of missing fields a
bit better and prevent quite a few crashes.