Changed array and record constructors and added array and record optimizations.