awesome accuracy. todo: clean the code; add comments