Various code additions