non tested implementatino of SSA, please check