Resolves #16 and fixes a bug in from input