use optional arguments instead of passing null around