Moved build over to Scons and moved a load of code around.