Modified for code optimization.