Defined some functions that will be used.