Added adcanved retrival and fixed a few bugs