Removing similar code