Edited and tested using serial monitor