made some stuff more reusable