separated code in functions so that it looks nice. Need to implement the respond function