added build file, depth-first processing feature, some bug fixes