changed much on the client side, flattened the result on the server side and added location type filter