updated class to be more OOPy and PHP5y