rewrited huge piece of code. style managing.