refactoring
using $q without setTimeout. safe REST method