Moved LCM exception into its namespace
Also added some tests for exceptions