Updated to correct file unlock; although functionality for permissions needs to be moved from model however.