Bug fix, restructure