FIX THE MEMORY MANAGEMENT PROBLEMS!!!