general cleanup of the code