move the code away from the main entry file