mostly tests, some function changes