square refactored and used in candidates