Almost finished updateBy function