made actions optional depending on parameters passed.