use ready() instead of result() and reorder imports