Updated with working LR code