Refactored code to comply with stricter compiler warning flags.
Refactored code to comply with additional compiler warning flags.
Fixed memory leak and improved memory mangement code's nanimg conventions.