Better error handling. Support for arrays