Clean up some repeated code, style changes