fixed the bug. still a long way to go.