Fixed returning plugin result within the loop when adding pins. Plus cleanup.