ldr and some tidyup