Issue #21: Now the number of periods is computed dynamically if user wants to let this happen (by passing a value for period smaller than 1). Added some bump constatns for later test cases. Cleaned up some code (minor).