Changed To Template Method. Some Null pointers need to be fixed