Partial sum implementation

Done + added tests.