Cleanup and small fixes