improved, style, fixed a couple of leaks