removed trailing new line from file
updated directive to work with asynchronous return data