Refactor. Still don't work