Init: made this function a little bit more general