added automatic platform detection