Improve code style and coverage