We show that the perfect matching problem is in the complexity class SPL in the nonuniform setting. This provides a better upper bound on the complexity of the matching problem, as well as providing motivation for studying the complexity class SPL. Using similar techniques, we show that counting the number of accepting paths of a nondeterministic logspace machine can be done in NL poly, if the number of paths is small. This clari es the complexity of the class FewL de ned and studied in BDHM91, BJLR91 . Using derandomization techniques, we then improve this to show that this counting problem is in NL. The material in this paper appeared in preliminary form in papers in the Proceedings of the IEEE Conference on Computational Complexity, 1998, and in the Proceedings of the Workshop on Randomized Algorithms, Brno, 1998. ySupported in part by NSF grants CCR-9509603 and CCR-9734918. zSupported in part by the DFG Project La 618 3-1 KOMET. xThe work was mainly done while the author was at Be...