code almost complete