add unit test, remove unused variables, and add usage description to the function, add default value for parameter, return NaN for empty array
delete vim temp file