Shorten a piece of code by using fromMaybe