Revised build so that system can be separately compiled. Also moved test programs to separate directory.