[backend] cleanup code a bit