add lock to pinner and rework cli