removed unnecessary code
Added functionality to save logs in database