added doc and cleaned up a bit