Factor out  determination and allow specification in args