Streamline beam loading logic in escript.build