Simple JS solution using function closures