changed function parameter order to reflect optionality