WIP-directive: More functionality added to directive. Some bug fixing as well.