Updating code to beta4 by merging in from uFactory's download site.

Please keep the github up to date so people don't have to manually merge successive betas.