Partially completed implementation in javascript, will now move on to replacing the 'Flow' library with 'Q'