moved lots of stuff back into ready function