Added template method for exception handling
Added documentation