implementation done, need to remove the printfs