Made changes to fix bugs i.e. exceptions or null pointers