Refactor the calculate method and break down to flatMarkup and otherMarkup