Adds javadoc for public interfaces
Extracts and renames variables for clarity