add tests for input arg ordering
use toposort properly