implemented I part, almost II.