moved sl code around