debugged on mac - will work better for all systems