Add support for anchor points. Code refactoring.