updated architecture, still need some fixing