Updated to fix some small bugs