implemented validate function and array support, improved logging