Clean up caps code