not finished yet I have to add some fixes at line 466