How to condense variables passed through to function?