Build scripts refactor