Added libs and corrected some bugs