Code improvements and corrections (e.g. pattern stimulation)