Added simple logging logic