separation of concerns into varoius functions