renamed some functions. added new test.