Added initial exception implementation, some cleanup