almost finish all functions