relay: cleanup code and add ability to kick