Some code-Cleanup and small fixes