improved assemble script