Finished off occupation function