Improved error messages in preconditions and addressed checkstyle
violations