Improved code style based on tests