Touchups/Typos: Ruby version. Added: more JS implementation.