putting code into more correct places