Memory leaks were eliminated

Memory logging was decreased;
Exceptions were refactored.