improve performance and architecture