Refactored the directive and updated the docs accordingly