working version tested with AmI modules