Debugging mad and sad functions