Refactored to enable automatic recursive compilation with -sourcepath.