rewrite ls manager code