fixed compile errors
implemented beaming