Minor code updates (I prefer native javascript when it works)