Simplified input/format check

Simplified with following logic: 

* if no input provided, returns undefined
* if no format provide, returns unformatted string