Refactored and moved the rest (filter) to main file