Edited and commented code