Added a manual and corrected some bugs