Added two suggestions and bug fixes from Alexander Koeppe