perft and divide unified

+ stylistic changes