loader: code cleanup