Rewrited most part, added lib