Changed button input to space-key input and added some loops