Cloned from pjstarifa and integrated new stuff