Updated LCP code to be more robust; updated event code