not sure if it is JS mandatory but I made the code looks disgusting to make it works