Made input handling null-safe and added support for an array of arguments