refactoring for series. still not so good but it work