added oc lenght checks to all functions