Added lazy file opening
Added tests for lazy flags