Working numerology code. Needs refactoring.