Merged the two main methods into one.
Also update the documentation to match the desired coding style.