Implemented cache for position, size and shift values
Refactoring