cleaned up and documentation added