Small refactoring; fixing memory leak; adding copyright notice for classes based on my gist.
Merge pull request #2284 from tklein23/develop

Small refactoring; fixing memory leak; fixing copyright notice