modified parameters to optional and adding j unit testing