Further improvements, more file checks, fix formatting errors