Clean up relay code