Modified the chunks function to return n equal chunks. Added some docstrings.