argument processing seperated into a function