Fixing #574

@Sama34 having thought about it, I have done as you suggest. I've also fixed the issue @ATofighi found. Please see pull request #823.