merged mathias and my version