Optimizations and reformatting to sight code