Defined $this->db
added updateK2 function