Added support for LDRs, lots of changes