Filtered logic solution a little so it's more cleaner.