added param length checks and expanded docs