a few changes and additions

some functions fixed and test files was added.