move os procedures to a module, add tests