Rewrited some code.