Changed file logging so it's a boolean
moved one line to make code reading easier