complete the basic implementation without global syncrhonzation