make the algoritam for platform detection more sophisticated