code update.. not finished yet