adding madlib refactor