Clean up the attribute filter code