Move orders code to right place