add debug statements and improve make dirs