Reorg code to run on flex 2.5.4 on uni melb servers and fixed minor errors