Add test for cascading job and minor refactor