clone and modify from https://code.google.com/p/dea/  1.4v