Few code style and performance changes