made more necessary changes

threshold added to input parameters for function.
Threshold suggested value ==10
Worked on the parantheses idea.
Need to test this code for bugs