         return filters[name]
 
     loadMyFilters: ->
-        deferred = @q.defer()
-        promise = @rs.issues.getMyFilters(@scope.projectId)
-        promise.then (filters) ->
-            result = _.map filters, (value, key) =>
-                obj = {
-                    id: key,
-                    name: key,
-                    type: "myFilters"
-                }
-                obj.selected = false
-                return obj
-            deferred.resolve(result)
-        return deferred.promise
+        return @rs.issues.getMyFilters(@scope.projectId).then (filters) =>
+            return _.map filters, (value, key) =>
+                return {id: key, name: key, type: "myFilters", selected: false}
 
     removeNotExistingFiltersFromUrl: ->
         currentSearch = @location.search()
         urlfilters = @.getUrlFilters()
+
         for filterName, filterValue of urlfilters
             if filterName == "page" or filterName == "orderBy" or filterName == "q"
                 continue


        promise = @.loadInitialData()

        promise.then () =>
            @appTitle.set("Issues - " + @scope.project.name)
            tgLoader.pageLoaded()

        promise.then null, ->
            console.log "FAIL" #TODO

        @scope.$on "issueform:new:success", =>
            @.loadIssues()

                obj.selected = if isSelected(obj.type, obj.id) then true else undefined

    loadFilters: ->
        urlfilters = @.getUrlFilters()

        if urlfilters.q
            @scope.filtersQ = urlfilters.q

        # Load My Filters
        promise = @.loadMyFilters().then (myFilters) =>
            @scope.filters.myFilters = myFilters
            return myFilters

        # Load default filters data
        promise = promise.then =>
            return @rs.issues.filtersData(@scope.projectId)

        # Format filters and set them on scope
        return promise.then (data) =>
            usersFiltersFormat = (users, type, unknownOption) =>
                reformatedUsers = _.map users, (t) =>
                    return {
                        id: t[0],
                        count: t[1],
                        type: type
                        name: if t[0] then @scope.usersById[t[0]].full_name_display else unknownOption
                    }
                unknownItem = _.remove(reformatedUsers, (u) -> not u.id)
                reformatedUsers = _.sortBy(reformatedUsers, (u) -> u.name.toUpperCase())
                if unknownItem.length > 0
                    reformatedUsers.unshift(unknownItem[0])
                return reformatedUsers

            choicesFiltersFormat = (choices, type, byIdObject) =>
                _.map choices, (t) ->
                    return {
                        id: t[0],
                        name: byIdObject[t[0]].name,
                        color: byIdObject[t[0]].color,
                        count: t[1],
                        type: type}

            tagsFilterFormat = (tags) =>
                return _.map tags, (t) =>
                    return {
                        id: t[0],
                        name: t[0],
                        color: @scope.project.tags_colors[t[0]],
                        count: t[1],
                        type: "tags"
                    }

            # Build filters data structure
            @scope.filters.statuses = choicesFiltersFormat(data.statuses, "statuses", @scope.issueStatusById)
            @scope.filters.severities = choicesFiltersFormat(data.severities, "severities", @scope.severityById)
            @scope.filters.priorities = choicesFiltersFormat(data.priorities, "priorities", @scope.priorityById)
            @scope.filters.assignedTo = usersFiltersFormat(data.assigned_to, "assignedTo", "Unassigned")
            @scope.filters.createdBy = usersFiltersFormat(data.created_by, "createdBy", "Unknown")
            @scope.filters.types = choicesFiltersFormat(data.types, "types", @scope.issueTypeById)
            @scope.filters.tags = tagsFilterFormat(data.tags)

            @.removeNotExistingFiltersFromUrl()
            @.markSelectedFilters(@scope.filters, urlfilters)
            @rootscope.$broadcast("filters:loaded", @scope.filters)

    loadIssues: ->
        @scope.urlFilters = @.getUrlFilters()
