Filter by tags implemented. Some parts of the code refactored.