 	 * 
 	 * @author Joa Ebert
 	 */
-	public final class Memory 
-	{
-		private static var domainMemory:ByteArray=null;
+	public final class Memory {
+		/**
+		 * The current application domain.
+		 * @private
+		 */
+		private static const applicationDomain: ApplicationDomain = ApplicationDomain.currentDomain;
+
 		/**
 		 * Selects a ByteArray object as the current memory.
 		 * 
 		 * @param byteArray The ByteArray object to work with.
 		 */
-		public static function select( byteArray: ByteArray ): void
-		{
-			ApplicationDomain.currentDomain.domainMemory = domainMemory = byteArray;
+		public static function select(byteArray: ByteArray): void {
+			applicationDomain.domainMemory = byteArray;
 		}
 		
 		/**

		 * @param value The value to extend.
		 * @return The extended value.
		 */
		public static function signExtend16( value: int ): int
		{
			if( 0 != ( value & 0x8000 ) )
			{
				value &= 0x7fff;
				value -= 0x8000;
			}

		 * @param address The address in memory.
		 * @param value The value to write.
		 */
		public static function writeInt(value: int, address: int): void {
			var domainMemory: ByteArray = applicationDomain.domainMemory;

			domainMemory.position = address;
			domainMemory.writeInt(value);
		}
		
		/**
