Many small fixes and beautifications