refactor code now compiles. Debugging a poll issue.