Add user credit query and update basic functions