Added advanced filtering and data write