improved ("open") support for other OSes (OS X and Windows) and code cleanup