starting to move to pure javascript implementation.