improve code organization (hopefully)