Fixed memory leaks and some warnings
Removed a comment in application