Refactored removeitem into directive