Re-implementation of bamm