First big fix for issue #23. The issue is as good as fixed besides some details I think.