Fixing the memory management and stuff

Added std::nothrow and a try-catch for now. Eventually need to switch over to something better.