wrtting tests, separated os dependent code, errors are still to be fixed