new version with JS working