Tweaking error handling and argument checking