Made some changes to prevent dpxdt server errors
Code cleanup and a bit of debugging