 
 struct SwiftQueue <T: Equatable> {
     typealias ElementType = T
-    
+
     private var storage = [ElementType]()
-    
+
     // MARK: Queryng the Queue
     var count: Int {
         return storage.count
     }
-    
+
     var isEmpty: Bool {
         return storage.isEmpty
     }
-    
+
     func front() -> ElementType? {
         return storage.first
     }
-    
+
     func back() -> ElementType? {
         return storage.last
     }
-    
+
     func findElement(element: ElementType) -> Int? {
-        return find(storage, element)
+        return storage.indexOf(element)
     }
-    
+
     // MARK: Adding and Removing Elements
-    
+
     mutating func pushBack(element: ElementType) {
         storage.append(element)
     }
-    
+
     mutating func popFront() -> ElementType? {
-        if let first = storage.first {
-            storage.removeAtIndex(0)
-            
-            return first
+        guard let _ = storage.first else {
+            return nil
         }
-        
-        return nil
+        return storage.removeAtIndex(0)
     }
-    
+
     mutating func clear() {
         storage.removeAll()
     }


// MARK: Debug

extension SwiftQueue: Printable {
    var description: String {
        return storage.description
    }


struct SwiftDequeue <T: Equatable> {
    typealias ElementType = T

    private var storage = [ElementType]()

    // MARK: Queryng the Dequeue
    var count: Int {
        return storage.count
    }

    var isEmpty: Bool {
        return storage.isEmpty
    }

    func front() -> ElementType? {
        return storage.first
    }

    func back() -> ElementType? {
        return storage.last
    }

    func findElement(element: ElementType) -> Int? {
        return storage.indexOf(element)
    }

    // MARK: Adding and Removing Elements

    mutating func pushBack(element: ElementType) {
        storage.append(element)
    }

    mutating func pushFront(element: ElementType) {
        storage.insert(element, atIndex: 0)
    }

    mutating func popFront() -> ElementType? {
        guard let first = storage.first else {
            return nil
        }
        storage.removeAtIndex(0)

        return first
    }

    mutating func popBack() -> ElementType? {
        guard let _ = storage.last else {
            return nil
        }
        return storage.removeLast()
    }

    mutating func clear() {
        storage.removeAll()
    }
