move functions to gw namespace. add ready function