fixed bugs and finished documentation