     for Name, properties of config.components
       name = Name[0].toLowerCase()+Name[1...]
       s0.push ""
-      s0.push "    [<AllowNullLiteral>]"
-      s0.push "    type #{Name}Component() ="
-      s0.push "        inherit Component()"
+      s0.push "class #{Name}Component() : IComponent {"
       if properties is false 
-        s0.push "        member val active = false with get, set"
+        s0.push "    var active:Boolean = false"
       else
         for p in properties
           name = p.split(':')[0]
+          type = getType(p.split(':')[1])
           value = getDefault(p.split(':')[1])
-          s0.push "        member val #{name} = #{value} with get, set"
-      
-    ###
-     * Systems Type Definitions
-    ###
-    for Name, interfaces of config.systems
-      name = Name[0].toLowerCase()+Name[1...]
-      sy = sys[Name] = []
-      sy.push "namespace #{config.namespace}"
-      sy.push ""
-      sy.push "/**"
-      sy.push " * Entitas Generated Systems for #{config.namespace}"
-      sy.push " *"
-      sy.push " */"
-      sy.push ""
-      sy.push "open Entitas"
-      sy.push "open System"
-      sy.push "open System.Collections.Generic"
-      sy.push ""
-      sy.push "type #{Name}(world:World) ="
-      
-      found = false
-      for iface in interfaces
-
-        if 'IExecuteSystem' is iface
-          sy.push "    interface IExecuteSystem with"
-          sy.push "        member this.Execute() ="
-          sy.push "            ()"
-          found = true
-          
-        if 'IInitializeSystem' is iface
-          sy.push "    interface IInitializeSystem with"
-          sy.push "        member this.Initialize() ="
-          sy.push "            ()"
-          found = true
-
-      sy.push "    class end" unless found 
-    sy.push ""
+          s0.push "    var #{name}:#{type} = #{value}"
+      s0.push "}"
+          
+      
                
     ###
      * Components List
     ###
     s0.push ""
-    s0.push "    type Component with "
-    s1.push "    type Entity with"     
-    s1.push ""     
-    s2.push "    type Matcher with"
-    s3.push "    type World with"
-    s3.push ""     
+    s0.push "enum class Component {"
     
     kc = 0
     for Name, properties of config.components
       name = Name[0].toLowerCase()+Name[1...]
-      s0.push "        static member #{Name} with get() = #{++kc}"    
-    s0.push "        static member TotalComponents  with get() = #{++kc}"    
-    s0.push ""
+      s0.push "    #{Name},"    
+    s0.push "    TotalComponents"    
+    s0.push "}"
   
     
     for Name, properties of config.components
-      name = Name[0].toLowerCase()+Name[1...];
-      
-      s1.push "        (** Entity: #{Name} methods*)"
+      name = Name[0].toLowerCase()+Name[1...]
+      
+      s1.push "/** Entity: #{Name} methods*/"
+      s2.push "/** Matcher: #{Name} methods*/"
+      
       
       switch properties
         when false
           s1.push ""
-          s1.push "        static member #{name}Component= new #{Name}Component()"
-          s1.push ""
-          s1.push "        member this.is#{Name}"
-          s1.push "            with get() ="
-          s1.push "                this.HasComponent(Component.#{Name})"
-          s1.push "            and  set(value) ="
-          s1.push "                if value <> this.is#{Name} then"
-          s1.push "                    this.AddComponent(Component.#{Name}, Entity.#{name}Component) |> ignore"
-          s1.push "                else"
-          s1.push "                    this.RemoveComponent(Component.#{Name}) |> ignore"
-          s1.push ""
-          s1.push "        member this.Is#{Name}(value) ="
-          s1.push "            this.is#{Name} <- value"
-          s1.push "            this"
-          s1.push ""
-          s2.push "        static member #{Name}"
-          s2.push "            with get() = "
-          s2.push "                Matcher.AllOf(Component.#{Name}) "
+          s1.push "val Entity_#{name}Component =  #{Name}Component()"
+          s1.push ""
+          s1.push "var Entity.is#{Name}:Boolean"
+          s1.push "    get() = hasComponent(Component.#{Name}.ordinal)"
+          s1.push "    set(value) {"
+          s1.push "        if (value != is#{Name})"
+          s1.push "            addComponent(Component.#{Name}.ordinal, Entity_#{name}Component)"
+          s1.push "        else"
+          s1.push "            removeComponent(Component.#{Name}.ordinal)"
+          s1.push "    }"
+          s1.push ""
+          
+          s2.push "val Matcher.static.#{Name}:IMatcher"
+          s2.push "     get() = Matcher.static.allOf(Component.#{Name}.ordinal) "
           s2.push ""
           
         else
           s1.push ""
-          s1.push "        member this.#{name}"
-          s1.push "            with get() = this.GetComponent(Component.#{Name}):?>#{Name}Component"
-          s1.push ""
-          s1.push "        member this.has#{Name}"
-          s1.push "            with get() = this.HasComponent(Component.#{Name})"
-          s1.push ""
-          s1.push "        member this._#{name}ComponentPool"
-          s1.push "             with get() = new Stack<#{Name}Component>()"
-          s1.push ""
-          s1.push "        member this.Clear#{Name}ComponentPool() ="
-          s1.push "            this._#{name}ComponentPool.Clear()"
-          s1.push ""
-          s1.push "        member this.Add#{Name}(#{params(properties)}) ="
-          s1.push "            let mutable c = "
-          s1.push "              match this._#{name}ComponentPool.Count with"
-          s1.push "              | 0 -> new #{Name}Component()"
-          s1.push "              | _ -> this._#{name}ComponentPool.Pop()"
+          s1.push "val Entity_#{name}ComponentPool:MutableList<#{Name}Component> = ArrayList(listOf())"
+          s1.push ""
+          s1.push "val Entity.#{name}:#{Name}Component"
+          s1.push "    get() = getComponent(Component.#{Name}.ordinal) as #{Name}Component"
+          s1.push ""
+          s1.push "val Entity.has#{Name}:Boolean"
+          s1.push "    get() = hasComponent(Component.#{Name}.ordinal)"
+          s1.push ""
+          s1.push "fun Entity.clear#{Name}ComponentPool() {"
+          s1.push "    Entity_#{name}ComponentPool.clear()"
+          s1.push "}"
+          s1.push ""
+          s1.push "fun Entity.add#{Name}(#{params(properties)}):Entity {"
+          s1.push "    val component = if (Entity_#{name}ComponentPool.size > 0) Entity_#{name}ComponentPool.last() else #{Name}Component()"
           for p in properties
-            s1.push "            c.#{p.split(':')[0]} <- #{p.split(':')[0]};"
-          s1.push "            this.AddComponent(Component.#{Name}, c)"
-          s1.push ""
-          s1.push "        member this.Replace#{Name}(#{params(properties)}) ="
-          s1.push "            let previousComponent = if this.has#{Name} then this.#{name} else null"
-          s1.push "            let mutable c = "
-          s1.push "              match this._#{name}ComponentPool.Count with"
-          s1.push "              | 0 -> new #{Name}Component()"
-          s1.push "              | _ -> this._#{name}ComponentPool.Pop()"
+            s1.push "    component.#{p.split(':')[0]} = #{p.split(':')[0]}"
+          s1.push "    addComponent(Component.#{Name}.ordinal, component)"
+          s1.push "    return this"
+          s1.push "}"
+          s1.push ""
+          s1.push "fun Entity.replace#{Name}(#{params(properties)}):Entity {"
+          s1.push "    val previousComponent = if (has#{Name}) #{name} else null"
+          s1.push "    val component = if (Entity_#{name}ComponentPool.size > 0) Entity_#{name}ComponentPool.last() else #{Name}Component()"
           for p in properties
-            s1.push "            c.#{p.split(':')[0]} <- #{p.split(':')[0]};"
-          s1.push "            this.ReplaceComponent(Component.#{Name}, c) |> ignore"
-          s1.push "            if not(isNull(previousComponent)) then"
-          s1.push "                this._#{name}ComponentPool.Push(previousComponent)"
-          s1.push "            this"
-          s1.push ""
-          s1.push "        member this.Remove#{Name}() ="
-          s1.push "            let c = this.#{name}"
-          s1.push "            this.RemoveComponent(Component.#{Name}) |> ignore"
-          s1.push "            this._#{name}ComponentPool.Push(c)"
-          s1.push ""
-          s2.push "        static member #{Name}"
-          s2.push "            with get() = "
-          s2.push "                Matcher.AllOf(Component.#{Name}) "
+            s1.push "    component.#{p.split(':')[0]} = #{p.split(':')[0]}"
+          s1.push "    replaceComponent(Component.#{Name}.ordinal, component)"
+          s1.push "    if (previousComponent != null)"
+          s1.push "        Entity_#{name}ComponentPool.add(previousComponent)"
+          s1.push "    return this"
+          s1.push "}"
+          s1.push ""
+          s1.push "fun Entity.remove#{Name}():Entity {"
+          s1.push "    val component = #{name}"
+          s1.push "    removeComponent(Component.#{Name}.ordinal)"
+          s1.push "    Entity_#{name}ComponentPool.add(component)"
+          s1.push "    return this"
+          s1.push "}"
+          s1.push ""
+          
+          s2.push "val Matcher.static.#{Name}:IMatcher"
+          s2.push "     get() = Matcher.static.allOf(Component.#{Name}.ordinal) "
           s2.push ""
           
     ###
      * Pooled Entities
     ###
-    for Name, pooled of config.entities
+    for Name, type of config.entities
         
-      s3.push "        (** World: #{Name} methods*)"
+        s3.push "/** Pool: #{Name} methods*/"
         
-      if pooled
         name = Name[0].toLowerCase()+Name[1...];
         properties = config.components[Name]
         if config.components[Name] is false
-          s3.push ""
-          s3.push "        member this.#{name}Entity"
-          s3.push "            with get() = this.GetGroup(Matcher.#{Name}).GetSingleEntity()"
-          s3.push ""
-          s3.push "        member this.is#{Name}"
-          s3.push "            with get() ="
-          s3.push "                this.#{name}Entity.NotNull"
-          s3.push "            and  set(value) ="
-          s3.push "                let entity = this.#{name}Entity"
-          s3.push "                if value <> entity.NotNull then"
-          s3.push "                    if value then"
-          s3.push "                        this.CreateEntity(\"#{Name}\").is#{Name} <- true"
-          s3.push "                    else"
-          s3.push "                        this.DestroyEntity(entity)"
-          s3.push ""
+            s3.push ""
+            s3.push "val Pool.#{name}Entity:Entity?"
+            s3.push "    get() = getGroup(Matcher.#{Name})?.getSingleEntity()"
+            s3.push ""
+            s3.push "var Pool.is#{Name}:Boolean"
+            s3.push "    get() = #{name}Entity != null"
+            s3.push "    set(value) {"
+            s3.push "        val entity = #{name}Entity"
+            s3.push "        if (value != (entity != null))"
+            s3.push "            if (value)"
+            s3.push "                createEntity(\"#{Name}\").is#{Name} = true"
+            s3.push "            else"
+            s3.push "                destroyEntity(entity)"
+            s3.push "    }"
+            s3.push ""
         else
-          s3.push ""
-          s3.push "        member this.#{name}Entity"
-          s3.push "            with get() = this.GetGroup(Matcher.#{Name}).GetSingleEntity()"
-          s3.push ""
-          s3.push "        member this.#{name}"
-          s3.push "            with get() = this.#{name}Entity.#{name}"
-          s3.push ""
-          s3.push "        member this.has#{Name}"
-          s3.push "            with get() = this.#{name}Entity.NotNull"
-          s3.push ""
-          s3.push "        member this.Set#{Name}(newValue) ="
-          s3.push "            if this.has#{Name} then"
-          s3.push "                failwith \"Single Entity Exception: #{Name}\""
-          s3.push "            let entity = this.CreateEntity(\"#{Name}\")"
-          s3.push "            entity.Add#{Name}(newValue) |> ignore"
-          s3.push "            entity"
-          s3.push ""
-          s3.push "        member this.Replace#{Name}(newValue) ="
-          s3.push "            let entity = this.#{name}Entity"
-          s3.push "            if entity.IsNull then"
-          s3.push "                entity = this.Set#{Name}(newValue) |> ignore"
-          s3.push "            else"
-          s3.push "                entity.Replace#{Name}(newValue) |> ignore"
-          s3.push "            entity"
-          s3.push ""
-          s3.push "        member this.Remove#{Name}() ="
-          s3.push "            this.DestroyEntity(this.#{name}Entity)"
-          s3.push ""
-          
+            s3.push ""
+            s3.push "val Pool.#{name}Entity:Entity?"
+            s3.push "    get() = getGroup(Matcher.#{Name})?.getSingleEntity()"
+            s3.push ""
+            s3.push "val Pool.#{name}:#{Name}Component?"
+            s3.push "    get() = #{name}Entity?.#{name}"
+            s3.push ""
+            s3.push "val Pool.has#{Name}:Boolean"
+            s3.push "    get() = #{name}Entity != null"
+            s3.push ""
+            s3.push "fun Pool.set#{Name}(newValue:#{type}):Entity {"
+            s3.push "    if (has#{Name}) throw Exception(\"Single Entity Exception: #{Name}\")"
+            s3.push "    val entity = createEntity(\"#{Name}\")"
+            s3.push "    entity.add#{Name}(newValue)"
+            s3.push "    return entity"
+            s3.push "}"
+            s3.push ""
+            s3.push "fun Pool.replace#{Name}(newValue:#{type}):Entity {"
+            s3.push "    var entity = #{name}Entity"
+            s3.push "    if (entity == null)"
+            s3.push "        entity = set#{Name}(newValue)"
+            s3.push "    else"
+            s3.push "        entity.replace#{Name}(newValue)"
+            s3.push "    return entity"
+            s3.push ""
+            s3.push "}"
+            s3.push "fun Pool.remove#{Name}() {"
+            s3.push "    destroyEntity(#{name}Entity)"
+            s3.push "}"
+            s3.push ""
+            
                
     #
     # ./<Namespace>.fs - Component declarations

  for arg in args
    name = arg.split(':')[0]
    type = getType(arg.split(':')[1])
    s.push "#{name}"
    
  s.join(', ') 
  

    # ./Extensions/MatcherExtensions.fs
    # ./Extensions/WorldExtensions.fs
    #               

    # Components - overwrite
    fs.writeFileSync(path.join(process.cwd(), config.src, 
      "GeneratedComponents.kt"), s0.join('\n'))
    
    # Entity Extensions - overwrite
    fs.writeFileSync(path.join(process.cwd(), config.src, 
      "EntityExtensions.kt"), s1.join('\n'))

    # Matcher Extensions - overwrite
    fs.writeFileSync(path.join(process.cwd(), config.src, 
      "MatcherExtensions.kt"), s2.join('\n'))

    # Pool Extensions - overwrite
    fs.writeFileSync(path.join(process.cwd(), config.src, 
      "PoolExtensions.kt"), s3.join('\n'))
