diff --git a/tree.lua b/tree.lua
index 14cb4c0c04e04d23e8c8f4186d2d01f813f02d8a..2a55086737bec7bae95a961c51f0c73cd9132158 100644
--- a/tree.lua
+++ b/tree.lua
@@ -1,21 +1,70 @@
-local size = 50
+local leds = {
+    30,
+    20,
+    10,
+    5,
+    2,
+}
+
 local height_increment = 3
+local size = (#leds + 1) * 2
 
 local function place_tree(pos)
     local set = {}
     local iled = 0
+    local blocks_per_layer = {}
     for iy = 0, size - 1 do
+        blocks_per_layer[iy] = 0
         for ix = iy, size - 1 - iy do
             for iz = iy, size - 1 - iy do
                 for h = 0, height_increment - 1 do
                     table.insert(set, {x = pos.x + ix, y = pos.y + iy * height_increment + h, z = pos.z + iz})
                     iled = iled + 1
-
+                    blocks_per_layer[iy] = blocks_per_layer[iy] + 1
                 end
             end
         end
+        blocks_per_layer[iy] = blocks_per_layer[iy] / height_increment
+        blocks_per_layer[iy] = math.sqrt(blocks_per_layer[iy]) * 4 - 4
     end
     minetest.bulk_set_node(set, {name = "ledtree:pine_needles"})
+
+    local loop_run = 0
+    local id = 0
+    for iy = 0, size - 1 do
+        loop_run = loop_run + 1
+
+        if loop_run <= #leds then
+            local led_count = leds[iy + 1]
+            local led_per_side = math.ceil(led_count / 4)
+
+            local layer_size = size - 2 * iy
+            local led_index = 1
+
+            for ix = iy, iy + layer_size - 1 do
+                for iz = iy, iy + layer_size - 1 do
+                    if led_index <= led_count then
+                        local led_pos = {}
+
+                        if (ix == iy or ix == iy + layer_size - 1 or iz == iy or iz == iy + layer_size - 1) then
+                            if not ((ix == iy and iz == iy) or (ix == iy and iz == iy + layer_size - 1) or
+                                    (ix == iy + layer_size - 1 and iz == iy) or (ix == iy + layer_size - 1 and iz == iy + layer_size - 1)) then
+                                led_pos.x = pos.x + ix
+                                led_pos.z = pos.z + iz
+
+                                led_pos.y = pos.y + iy * height_increment + math.floor(height_increment / 2)
+
+                                core.set_node({x = led_pos.x, y = led_pos.y, z = led_pos.z}, {name = "ledtree:led"..id.."_red"})
+                                id = id + 1
+
+                                led_index = led_index + 1
+                            end
+                        end
+                    end
+                end
+            end
+        end
+    end
 end
 
 core.register_node("ledtree:ledtree", {