cleaned up code, fixed minor error with character rendering.