Fixes a number of issues
Clean up