Minor adjustments

Fixed some adjustments to the code, and fixed some issues.