fixed search, added debug console.logs, fixed max_id (why was it an arbitrarily high number?)