completed with minor errors