little perf and style improvements