Corrected the pop method. Also wrote the test section.