Replaced use of global variables with self-modifying code. Size 1013.