General cleanup of the code