first working (maybe?) version of beam