Tidied up memory allocation in capabilities