added some comments. Moved definition and implementation to .h files