Re-factoring + logging cleanup