Move offline code to the right place