As a safe-guard against bad input, this should be moved into a separate PR. Also, one line if blocks should be guarded by curly braces, too.