Refactoring for 'build' function.
Insert installed/error logs in 'build' function.