made code more object oriented, many code cleanups

13 files changed