finish implementing all functions