Made platform detection runtime instead of compile time