Working, but needs refactoring again.