Performance tweaks: remove array_push, skip GD, some minors