Fixed invalid filters from previous changes as well as code refactors.

Signed-off-by: crynobone <crynobone@gmail.com>