added support to handle both list and matrix forms for attributes