Simplify code, and make to code following conventions better