This class needs to be re-written.