Refactored to make it easier to update. Added CP settings. Still need to try to make it self contained.