slim: remove duplicate code