Modified code to be cleaner in instantiation