Added some functions to report back the memory consumption -- to be removed after some more testing
Added tests and test-cases