Bug-fixes from the last commit. Re-organized test files so that testing
on different machines would be easier.