Finished improving the first phase, it is now safe to use this version