Refactor draw pixel, fix some undeclared var errors.