Simplify some code, style changes