Refactor to get rid of frames