better implentation