Implementing directives and pagination