Clean up listener code