moving code to the app directory where it belongs