merged Hiram's code.

Signed-off-by: arioch666 <divij.durve@gmail.com>