minor refactoring + added line drawing facility.