cleanup, improved cross platform compatibility