Performance and code optimization