refactoring initialization and response processing in favor of readability and performance

use constant to define cache size