Changed code style, now fixed all bugs and lacks