Updated to create function for opening log file