Remove dead log statements and clean up code structure