Formatting & some optimizations