Fix platform dependent code and add visualization