added some further changes, fixed bugs