some code cleanup
moar debug!