Initial work.
Cleaning up
Removing duplicate code.
Adding comments and cleaning up code.
Updated package.