add additional debug logging and refactoring
add additional debug logging and refactoring

lrstanley/marill,Liamraystanley/marill,lrstanley/marill,lrstanley/marill,Liamraystanley/marill,Liamraystanley/marill