Maybe a pattern matching function for converting the roletype atom to a binary here, instead of this?