Many improvments

Check each commit for details.