removed unecessary code
improved logging