Updated some of the code from a different project, this project will also
be depricated as there are other projects that require attention.