Resolves #1 as suggested by @brigand