JBSEAM-5062 with some improvements