Refactored timeseries.rb with documentation and method cleaning suggested by Claudio Bustos.