Add validation and JavaDoc