Edited source for readability