using listToMaybe instead of head