made a few changes and a few bug fixes