changed a lot of codes.