filter parsing improved to work without brackets and consider order of precedence