New JS implementation with no need for external helpers