Final version that does not crash