making this cross platform - in an efficient way