Update style, add common helper functions, make better.