updated bam.lua and added network functions