fixed version + made local function actually local