Putting the end statement on the same line does not work. As I want to have the function signature in here to have the interfaces documented in the code, I will convert them to the style of `(handler::XPStreamHandler) -> nothing`