Fix inputing multiple operator.

Also some refactor for reducing unnecessary code.
This is just personal preference, but I prefer to keep it as two separate lines and avoid casting. :thumbsup: