Fixed some code issues and added old code for referencing

Added old code to the tree for now until I can completely revamp the
project. The older version works on php5+. This new version will be
using traits so php5.4+ is required.