Moved logging functions into a class
Added code documentation